package com.itheima;

import com.itheima.dao.BookDao;
import com.itheima.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Xiao
 * @date 2021/9/11
 */
public class App03 {
    public static void main(String[] args) {
        //获取ApplicationContext容器
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //获取Bean对象
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        BookDao bookDaoimpl1 = (BookDao) ctx.getBean("BookDaoimpl1");
        BookDao bookDaoimpl2 = (BookDao) ctx.getBean("BookDaoimpl2");
        System.out.println(bookDao);
        System.out.println(bookDaoimpl1);
        System.out.println(bookDaoimpl2);
        //调用方法
        bookDao.save();         // book dao save...
        bookDaoimpl1.save();    // book dao save...
        bookDaoimpl2.save();    // book dao save...
    }
}
